package com.ql.mangersystem.service.impl;

import com.ql.mangersystem.mapper.FileOperationMapper;
import com.ql.mangersystem.service.FileOperationService;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

@Service
@Component
public class FileOperationServiceImpl implements FileOperationService {
    @Resource
    private FileOperationMapper fileOperationMapper;
    private static final Integer operation3=3;

    @Override
    public int uploadInsert(Integer fileId) {
        LocalDateTime now = LocalDateTime.now();
        Integer operation = 1;
        return fileOperationMapper.uploadInsert(now, operation,fileId);
    }

    @Override
    public int insertDownload(Integer id, LocalDateTime now) {
        Integer operation2 = 2;
        return fileOperationMapper.insertDownload(id,now, operation2);
    }

    @Override
    public int rename(Integer id) {
        LocalDateTime now = LocalDateTime.now();
        return fileOperationMapper.insertEdit(id,now,operation3);
    }

    @Override
    public int logicDelBatch(List<Integer> ids) {
//        List<Integer> ids = fileDeleteBatchDTO.getIds();
        LocalDateTime now = LocalDateTime.now();
        return fileOperationMapper.logicDelBatch(ids,now,operation3);
    }
}
